﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WZVTC.SoftDev.DDDFW.EntityServices;
using Repository;
using Model;

namespace EntityServices
{
    //所有EntityServices的工厂，用于保证在同一会话中，有一个唯一的上下文
    public class TimeTableOneEntityServicesFactory: EntitiesServicesFactory
    {

        public TimeTableOneEntityServicesFactory() : base(new TimeTableContainer()) { }
        学院Service _学院Service = null;
        用户Service _用户Service = null;
        班级Service _班级Service = null;
        课程Service _课程Service = null;
        系部Service _系部Service = null;
        教师Service _教师Service = null;

        public 用户Service 用户Service
        {
             get {
                if (_用户Service == null)
                    _用户Service = new 用户Service(base._context, new 用户Repository(base._context));
                return _用户Service;
            }
        }

        public 学院Service 学院Service
        {
            get {
                if (_学院Service == null)
                    _学院Service = new 学院Service(base._context, new 学院Repository(base._context));
                return _学院Service;
            }
        }

        public 班级Service 班级Service
        {

            get
            {
                if (_班级Service == null)
                    _班级Service = new 班级Service(base._context, new 班级Repository(base._context));
                return _班级Service;
            }
        }

        public 课程Service 课程Service
        {
            get
            {
                if (_课程Service == null)
                    _课程Service = new 课程Service(base._context, new 课程Repository(base._context));
                return _课程Service;
            }
        }

        public 系部Service 系部Service
        {
            get
            {
                if (_系部Service == null)
                    _系部Service = new 系部Service(base._context, new 系部Repository(base._context));
                return _系部Service;
            }
        }

        public 教师Service 教师Service
        {
            get
            {
                if (_教师Service == null)
                    _教师Service = new 教师Service(base._context, new 教师Repository(base._context));
                return _教师Service;
            }
        }

    }
}
